import Http from "@/utils/request";

export const userLogin = (data: IUserLogin) => Http.post<BaseResponse<string>, IUserLogin>({ url: "/user/login", data })

export const userDetail = () => Http.get<BaseResponse<UserInfoDetail>>({ url: `/user/detail` });

export const listEmployeeByServiceId = (serviceId: number) => Http.get<BaseResponse<EmployeeList[]>, number>({ url: `/user/listEmployee/${serviceId}` })

export const updateAddress = (oldAddressId: number, newAddressId: number) => Http.post<BaseResponse<string>, { oldAddressId: number, newAddressId: number }>({ url: "/user/updateAddress?", params: { oldAddressId, newAddressId } });

export const getAddressList = () => Http.get<BaseResponse<AddressList[]>>({ url: "/user/addressListByUserId" });

export const addNewAddress = (newAddress: string) => Http.post<BaseResponse<string>, string>({ url: "/user/addNewAddress?", params: { newAddress } });

export const updateAvatar = (data: string) => Http.post<BaseResponse<string>, string>({ url: "/user/updateAvatar", data });

export const updateGender = (data: boolean) => Http.post<BaseResponse<boolean>, boolean>({ url: "/user/updateGender", data });

export const updateFavorite = (employeeId: number, status: boolean) => Http.post<BaseResponse<string>, { employeeId: number, status: boolean }>({ url: "/user/updateFavorite?", params: { employeeId, status } })

export const employeeDetail = (employeeId: number) => Http.get<BaseResponse<EmployeeInfoDetail>>({ url: `/user/employeeDetail/${employeeId}` })

export const chargeBalance = (chargeVal: number) => Http.post<BaseResponse<string>, number>({ url: `/user/chargeBalance/${chargeVal}` })

export const queryBalance = () => Http.get<BaseResponse<number>>({url: "/user/queryBalance"})